/*
 * File Created: 2019-11-28 16:21:17
 * Author: 余保林 (yubaolin6@outlook.com)
 * Desc: 产品管理相关接口
 * Last Modified: 2019-11-30 16:21:03
 * Modified By: 余保林 (yubaolin6@outlook.com>)
 */

import request from '@/utils/request'
import Qs from 'qs'

export function productQuery(params) {
  return request.get(`/platform/privilege/products/query?${Qs.stringify(params)}`)
}

export function productAdd(data) {
  return request.post('/platform/privilege/products', data)
}

export function productEdit(id, data) {
  return request.patch(`/platform/privilege/products/${id}`, data)
}

export function productDel(id) {
  return request.delete(`/platform/privilege/products/${id}`)
}

export function productDetail(id) {
  return request.get(`/platform/product/item?productId=${id}`)
}

/**
 * 名字搜索使能产品
 */
export function productNamesEnable(name = '') {
  return request.get(`/platform/privilege/product/names/enable?name=${name}`)
}


/**
 * 指定品牌下的全部启用的产品
 * 
 * @export
 * @param {*} brandId
 * @returns
 */
export function productEnableByBrand(brandId) {
  return request.get(`/platform/privilege/product/brand/${brandId}/names/enable`)
}

export function productEnableAll(name = '') {
  return request.get(`/platform/privilege/product/names?name=${name}`);
}